<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/common.jsp"%>
<link rel="stylesheet" href="${ctx}/page/include/css/memberInfo.css" />
<script type="text/javascript" src="${ctx}/page/shop/js/orderPay.js"></script>
<title>订单支付</title>
</head>
<body>
		<%@ include file="../common/header.jsp"%>
		<div class="container">
			<div class="row">
				<div class="col-md-9">
					<div class="panel panel-default">
						<div class="panel-heading">积分支付</div>
						<div class="panel-body">
							<c:if test="${pointAccount.hasPassword eq 0}">
								<p>你还未设置支付密码，请点此先去<a href="${ctx}/memberCenter/alterPayPassword">设置支付密码</a></p>
							</c:if>
							<c:if test="${pointAccount.hasPassword eq 1}">
								<c:if test="${pointAccount.currentValue lt order.value}">
									<p>你当前的积分余额为<strong><fmt:formatNumber type="number" value="${pointAccount.currentValue}" pattern="0.00" maxFractionDigits="2"/></strong>,不足以支付该订单，请先<a href="${ctx}/point/pointRecharge">充值</a>。</p>
								</c:if>
								<c:if test="${pointAccount.currentValue ge order.value}">
									<p>你当前的积分余额为<strong><fmt:formatNumber type="number" value="${pointAccount.currentValue}" pattern="0.00" maxFractionDigits="2"/></strong>,需要支付<strong style="color: #c61822"><fmt:formatNumber type="number" value="${order.value}" pattern="0.00" maxFractionDigits="2"/></strong>积分。(1积分等于1元)</p>
									<form class="m-t" role="form">
										<div class="form-group">
											<input id="password" name="password" type="password"
												class="form-control" placeholder="请输入支付密码">
										</div>
										<div class="form-group">
											<div class="input-group">
												<input id="code" name="code" type="text"
													class="form-control" placeholder="请输入验证码">
												<span class="input-group-btn">
													<button onclick="sendEmailCode()" class="btn btn-default"
														type="button">获取邮箱验证码</button>
												</span>
											</div>
										</div>
										<button type="button" class="btn btn-default"
											onclick="pay('${order.orderNo}')">确认支付</button>
										<span id="error_message"></span>
									</form>
								</c:if>
							</c:if>
						</div>

					</div>
				</div>
				<div class="col-md-3 hidden-sm hidden-xs">
					<%@ include file="../include/memberInfoInShop.jsp"%>
				</div>
			</div>
		</div>
		<%@ include file="../common/footer.jsp"%>
	
	<script type="text/javascript">
		function sendEmailCode(){
			$.ajax({
				type : 'POST',
				url : ctx + '/sendEmailCode.do',
				data : {
				},
				dataType : 'json',
				timeout : 30000,
				context : $('body'),
				success : function(data) {
					if (data.code == "ok") {
						showTip2('验证码已经发送到您的邮箱，请注意查收!');
					} else {
						showTip2(data.msg);
					}
				},
				error : function(xhr, type) {
					showTip2('提交失败!');
				}
			});
		}
	</script>
</body>
</html>